DefaultStatesManager

fun <T : State> DefaultStatesManager(repo: DefaultStatesManagerRepo<T> = InMemoryDefaultStatesManagerRepo(), onContextsConflictResolver: suspend (T, T, T) -> Boolean = { _, _, _ -> true })

Parameters

repo

This repo will be used as repository for storing states. All operations with this repo will happen BEFORE any event will be sent to onChainStateUpdated, onStartChain or onEndChain. By default will be used InMemoryDefaultStatesManagerRepo or you may create custom DefaultStatesManagerRepo and pass as repo parameter

onContextsConflictResolver

Receive old State, new one and the state currently placed on new State.context key. In case when this callback will returns true, the state placed on State.context of new will be replaced by new state by using endChain with that state